#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define clr(x, y, i) memset(x, 0, sizeof(i) * (y))
#define cpy(x, y, z, i) memset(x, y, sizeof(i) * (z))
#define fro(i, x, y) for(int i = (x);i <= (y);i++)
#define pre(i, x, y) for(int i = (x);i >= (y);i--)

typedef long long ll;
typedef pair<int, int> PII;
typedef unsigned long long ull;

const int N = 200010;
const int mod = 998244353;

int n, m, a[N], b[N], t1[N], t2[N], t3[N], t4[N], co1[N], co2[N];

inline void insert1(int a, int b = 0)
{
    pre(i, 30, 0)
    {
        if(a & (1 << i))
        {
            if(t3[i]) a ^= t3[i], b ^= t4[i];
            else return t3[i] = a, t4[i] = b, void();
        }
    }
}

inline void insert2(int a, int b)
{
    pre(i, 30, 0)
    {
        if(b & (1 << i))
        {
            if(t2[i]) b ^= t2[i], a ^= t1[i];
            else return t1[i] = a, t2[i] = b, void();
        }
    }
    insert1(a);
}

inline PII get(int x)
{
    int y = 0;
    pre(i, 30, 0)
    {
        if(x & (1 << i))
        {
            if(m & (1 << i))
            {
                if(t3[i]) return {(x ^ t3[i]), y ^ t4[i]};
            }
            else
            {
                if(t3[i]) x ^= t3[i], y ^= t4[i];
                else return {-1, -1};
            }
        }
        else if(m & (1 << i))
            return {x, y};
    }
    return {x, y};
}

inline int ask()
{
    int res = 0, els = 0;
    pre(i, 30, 0)
    {
        if(res & (1 << i))
            continue;
        res ^= t2[i], els ^= t1[i];
        fro(j, 0, 30) co1[j] = t3[j], co2[j] = t4[j];
        fro(j, 0, i - 1) if(t1[j]) insert1(t1[j], t2[j]);
        auto x = get(els);
        if(x == make_pair(-1, -1)) res ^= t2[i], els ^= t1[i];
        else res ^= x.y, els = x.x;
        fro(j, 0, 30) t3[j] = co1[j], t4[j] = co2[j];
    }
    return res;
}

int main()
{
    freopen("lock.in", "r", stdin);
    freopen("lock.out", "w", stdout);
    cin >> n >> m;
    fro(i, 1, n)
    {
        cin >> a[i] >> b[i];
        insert2(a[i], b[i]);
    }
    cout << ask() << endl;
    return 0;
}